import {Service} from "adajs";
import LgbList from "./../../lists/lgb";

class LodgeService extends Service {
    defaultData() {
        return {
            id: "",
            info: {
                zbid: "",
                zbsj: "",
                zbfsj: "",
                zzwy: "",
                xcwy: "",
                jjwy: "",
                hddd: "",
                hjsj: "",
                dyCount: ""
            },
            list: {
                type: LgbList,
                url: "/api/lgb/app/lgb/oldperson/queryPage",
                parameter: {
                    szdzb: ""
                }
            }
        };
    }

    onupdate(current, data) {
        if (data.id) {
            return this.context.request.get("/api/lgb/app/lgb/branchinformation/get", {id: data.id}).then(({data}) => {
                current.id = data.id;
                Object.assign(current.info, data);
                current.list.parameter.szdzb = data.id;
            });
        }
    }
}

export default LodgeService;